import React from 'react'
import {useSelector,useDispatch} from 'react-redux';
import {getMovieAct} from "../../store/slice/movieSlice"
export default function Movie() {
    const dispatch = useDispatch();
    const count = useSelector(state => {
        return state.count.count
    })
    const movieList = useSelector(state => {
        return state.movie.movieList
    })
    const getMovieListS = () => {
        dispatch(getMovieAct())
    }
  return (
    <div>
        <h1>我是Movie组件</h1>
        <p>我收到Count组件的值是{count}</p>
        <button onClick ={ getMovieListS }>点击获取电影</button>
        <ul>
            {
                movieList.map(item => {
                    return <li key={item.tvId}>{item.name}</li>
                })
            }
        </ul>
    </div>
  )
}
